package com.webmuseum.client;

import java.util.ArrayList;
import java.util.List;

public class StringManager 
{
	private static StringManager mInstance;
	private List<String> mList;
	
	private StringManager()
	{
		mList = new ArrayList<String>();
	}
	
	public static StringManager getInstance()
	{
		if(mInstance == null)
		{
			mInstance = new StringManager();
		}
		
		return mInstance;
	}
	
	private String findString(String aString)
	{
		String s = null;
		for(int i=0; i< mList.size();++i)
		{
			if(mList.get(i).equals(aString))
			{
				s = mList.get(i);
				break;
			}
		}
		
		return s;
	}
	public String addString(String aString)
	{
		String s = findString(aString);
		if(s == null)
		{
			s = new String(aString); 
			mList.add(s);
		}
		return s;
	}
	
	public List<String> getStringList()
	{
		return mList;
	}
	
}
